// bind 简化版

// ES 5
Function.prototype.myBind = function (context) {
  if (typeof this !== 'function') {
    throw 'caller must be a function'
  }

  context = context || window

  var self = this

  var args = Array.prototype.slice.call(arguments, 1)
  // let args = [...arguments].slice(1)

  return function () {
    var bindArgs = Array.prototype.slice.call(arguments, 1)

    return self.apply(context, args.concat(bindArgs))
  }

}

let bind = (fn, obj, ...args) => (..._args) => fn.call(obj, ...args, ..._args)

